package com.lovo.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页对象
 * @param <T>
 */
public class Page<T> {
    /**
     * 每页显示数
     */
    private int pageSize = 5;
    /**
     * 总页数
     */
    private int totalPage;
    /**
     * 总条数
     */
    private int count;
    /**
     * 查询出来的分页数据
     */
    private List<T> list = new ArrayList();

    @Override
    public String toString() {
        return "Page{" +
                "pageSize=" + pageSize +
                ", totalPage=" + totalPage +
                ", count=" + count +
                ", list=" + list +
                '}';
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
        this.totalPage = (int)Math.ceil(count / (double)pageSize);
    }


    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
